<!--
 * @描述：【历史委托订单】
 * @作者：lichenguang
 * @时间: 2022/2/24 23:01
-->
<template>
  <div class="app-container">
    <el-table :data="tableData" style="width: 100%" border v-loading="loading">
      <el-table-column prop="currency" label="委托币种" align="center"></el-table-column>
      <el-table-column prop="tradeDate" label="委托时间" align="center"></el-table-column>
      <el-table-column label="挂单类型" align="center">
        <template slot-scope="{row}">
          {{ row.type | entrust_type_to_Ch }}
        </template>
      </el-table-column>
      <el-table-column prop="price" label="价格" align="center"></el-table-column>
      <el-table-column prop="totalAmount" label="挂单总数量" align="center"></el-table-column>
      <el-table-column prop="tradeAmount" label="已成交数量" align="center"></el-table-column>
      <el-table-column prop="fees" label="交易手续费" align="center"></el-table-column>
      <el-table-column label="挂单状态" align="center">
        <template slot-scope="{row}">
          {{ row.status | entrust_status_to_Ch }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  import {ordersHistory} from '@/api/modules/account'
  import {entrust_type_to_Ch, entrust_status_to_Ch} from '@/utils/codeTransition';

  export default {
    name: "OrdersHistory",
    filters: {
      entrust_type_to_Ch,
      entrust_status_to_Ch
    },
    data() {
      return {
        tableData: [],
        userId: this.$route.query.userId,
        loading: false
      }
    },
    created() {
      this.loading = true
      this.list()
    },
    methods: {
      list() {
        ordersHistory({'userId': this.userId}).then(res => {
          this.tableData = res.data
          this.loading = false
        })
      }
    }
  }
</script>

<style scoped>

</style>
